package com.garen.sys.web;

import com.garen.sys.biz.IFireCodeBiz;
import com.garen.sys.entity.FireCode;
import org.springframework.stereotype.Controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import com.garen.common.*;
import org.springframework.web.servlet.ModelAndView;
import com.garen.sys.filter.SysFilter;


@Controller
@RequestMapping("/sys")
public final class FireCodeAction extends BaseAction{

	protected static Log log = LogFactory.getLog(FireCodeAction.class);

	@Autowired
	private IFireCodeBiz iFireCodeBiz;

	@RequestMapping("/firecode/json") 
	public ModelAndView json(PageBean<FireCode> pb,FireCode fireCode) {
		iFireCodeBiz.getFireCodeList(pb,fireCode);
		return Json(pb);
	}

	@RequestMapping("/firecode/boxJson") 
	public ModelAndView boxJson(FireCode fireCode) {
		return Json(iFireCodeBiz.getFireCodeList(fireCode));
	}

	@RequestMapping("/firecode/edit") 
	public ModelAndView edit(ModelAndView mav,FireCode fireCode) {
		mav.setViewName("sys/FireCodeEdit");
		if(fireCode.getCodeId() != null){
			fireCode=iFireCodeBiz.getFireCode(fireCode);
		}
		mav.addObject("fireCode",fireCode);
		return mav;
	}

	@RequestMapping("/firecode/save") 
	public ModelAndView save(FireCode fireCode) {
		MsgBean mbean = SysFilter.getMsgBean(0, "保存成功 !");
		iFireCodeBiz.saveFireCode(mbean,fireCode);
		return Json(mbean);
	}

	@RequestMapping("/firecode/del") 
	public ModelAndView del(FireCode fireCode) {
		MsgBean mbean = SysFilter.getMsgBean(0, "删除成功 !");
		iFireCodeBiz.delFireCode(mbean,fireCode);
		return Json(mbean);
	}

}
